
% Given
Costs = ...
    [0 20 10;...
     40 0 5;...
     10 10 0];
 
cities = [2,1,3] ;
% When
c = cost(cities, Costs);
% Then
assert(c==60);